// loginButton.tsx
import React from 'react';
import type { FormInstance } from 'antd';
import { Button, message, Space, Tooltip } from 'antd';
import SignInMore from './signInMore';

const handleButtonClick = (clientReady: boolean, form: FormInstance) => {
    message.info('Click on left button.' + clientReady+form.getFieldsValue().username+form.getFieldsValue().password);
};



const SignInButton: React.FC<{ form: FormInstance; clientReady: boolean }> = ({ form, clientReady }) => {
    const btnStatus = !clientReady ||!form.isFieldsTouched(true) ||!!form.getFieldsError().filter(({ errors }: { errors: string[] }) => errors.length).length

    return (
        <Space wrap>
            <Tooltip title="登录">
                <Button
                style={{padding: '0 10px'}}
                size='small'
                    // type="primary"
                    // icon={<MoreOutlined />}
                    onClick={() => handleButtonClick(clientReady, form)}
                    disabled={
                        btnStatus
                    }
                >登录
                </Button>
            </Tooltip>
            <SignInMore />
    
        </Space>
    );
};

export default SignInButton;